<template>
	<view class="root">
		<view v-for="(item,index) in communityList" :key="index">
			<Community-card
					:info="item" :isIndex="0"
			></Community-card>
		</view> 
		<u-tabbar :list="vuex_tabbar" :mid-button="true" @change="clickTabbar" :current="0"></u-tabbar>
	</view>
</template>

<script>
	import {
		mapState,
		mapMutations
	} from 'vuex';
	import {Community} from "../../model/community.js";
	
	import CommunityCard from '../../components/community-card/index.vue';
	
	export default {
		data() {
			return {
				title: 'Hello',
				communityObject:"",
				communityList:[],
			}
		},
		components:{CommunityCard},
		computed: {
			...mapState(['vuex_tabbar'])
		},
		async onLoad(){
			this.initList();
		},
		mounted() {
			console.log(this.vuex_tabbar)
		},
		methods: {
			clickTabbar() {
				console.log(123)
			},
			async initList(){
				//初始化最新首页数据
				var paging = await Community.getContent();
				var data = await paging.getMoreData();
				if(!data.moreData){
					this.status="nomore";
				};
				console.log(data)
				this.communityList=this.communityList.concat(data.items);
				
				this.communityObject=paging;

			},
		}
	}
</script>

<style lang="scss">

</style>
